﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<CarHelpDesk.Web.Models.Question>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Въпроси
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2> <%= ViewData["IndexTitle"] %>
    Въпроси</h2>
    <div style="overflow:auto;height:300px;">
    <table style="width: 98%;">
        <tr>
            <th>
                Дата
            </th>
            <th>
                Заглавие
            </th>
            <th>
                Автор
            </th>
            <th>
                Съдържание
            </th>
        </tr>

    <% foreach (var item in Model) {
           if (item.Active == true)
           { %>
        
        <tr>
            <td>
                <%= Html.Encode(String.Format("{0:g}", item.CreateDate.ToString("dd.MM.yyyy hh:mm tt")))%>
            </td>
            <td>
                <%= Html.ActionLink(item.Title, "Details", new { id = item.ID })%>
            </td>
            <td>
                <%= Html.Encode(item.aspnet_User.UserName)%>
            </td>
            <td>
                <%= Html.Encode(item.Content).Substring(0, Math.Min(item.Content.Length, 20)) + " ... "%>
            </td>
        </tr>
    
    <% }
       } %>

    </table>
    </div>   
  
   
    <% if (User.IsInRole("MegaModerator"))
               {%>                     
    <h2> <%= ViewData["IndexTitle"] %>
    Въпроси предложени за изтриване</h2>
    <div style="overflow:auto;height:300px;">
    <table style="width: 98%;">
        <tr>
            <th>
                Дата
            </th>
            <th>
                Заглавие
            </th>
            <th>
                Автор
            </th>
            <th>
                Съдържание
            </th>
        </tr>
   <% foreach (var item in Model) {
          if (item.Active == false)
          { %> 
        
        <tr>
            <td>
                <%= Html.Encode(String.Format("{0:g}", item.CreateDate.ToString("dd.MM.yyyy hh:mm tt")))%>
            </td>
            <td>
                <%= Html.ActionLink(item.Title, "Details", new { id = item.ID })%>
            </td>
            <td>
                <%= Html.Encode(item.aspnet_User.UserName)%>
            </td>
            <td>
                <%= Html.Encode(item.Content).Substring(0, Math.Min(item.Content.Length, 20)) + " ... "%>
            </td>
        </tr>
    
    <% }
      } %>

    </table>
    </div>
    <% } %>
</asp:Content>

